package com.example.zhihuigongdi.entity.respon;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class Result implements Serializable {
    private static final long serialVersionUID = 1L;

    private String message;

    private int code;

    private Object result;

    public static Result date(Object object) {
        Result r = new Result();
        r.result = object;
        return r;
    }

    public static Result success(Object object,String msg) {
        Result r = new Result();
        r.result = object;
        r.message=msg;
        r.code = 200;
        return r;
    }
    public static Result success(Object object) {
        Result r = new Result();
        r.result = object;
        r.code = 200;
        return r;
    }
    public static Result success(String message) {
        Result r = new Result();
        r.code = 200;
        r.message=message;
        return r;
    }

    public static Result error(String msg) {
        Result r = new Result();
        r.message = msg;
        r.code = 401;
        return r;
    }

    public static Result ok() {
        Result r = new Result();
        r.code = 200;
        return r;
    }

    public static Result wrong(String msg) {
        Result r = new Result();
        r.code = 401;
        return r;
    }

}
